<?php

namespace App\Models;


/**
 * App\Models\Level
 *
 * @property int $id
 * @property string $name 等级名称
 * @property string $cost 升级金额
 * @property string $icon 等级图标
 * @method static \Illuminate\Database\Eloquent\Builder|Level newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Level newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Level query()
 * @method static \Illuminate\Database\Eloquent\Builder|Level whereCost($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Level whereIcon($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Level whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Level whereName($value)
 * @mixin \Eloquent
 */
class Level extends Base{

    protected $table = 'levels';


    protected $fillable = [
        'id','name','cost','icon'
    ];

    public $timestamps = false;//关闭自动维护



    /**
     * 获取列表
     * @param array $fields 查询的字段
     * @return mixed
     */
    protected function getList($fields = ['*']){
        //
        $lists = $this->select($fields)->orderBy('id', 'desc')->paginate(config('app.limit'));
        return $lists;
    }

    protected function levels(){
        $levels = $this->select(['id','name'])->get()->toArray();
        return $levels;
    }
}
